Skip to content

Implement manifest-driven shader pipeline with runtime library, hot-reload, and metadata - #10

Merged
ercmine merged 1 commit into
mainfrom
codex/implement-shader-pipeline-for-rendering
Apr 6, 2026
Merged

Implement manifest-driven shader pipeline with runtime library, hot-reload, and metadata#10
ercmine merged 1 commit into
mainfrom
codex/implement-shader-pipeline-for-rendering

Conversation

@ercmine

@ercmine ercmine commented Apr 6, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Replace ad-hoc shader handling with a canonical, engine-owned shader pipeline that scales to many programs, stages and variants.
  • Provide deterministic include resolution, shared include files, backend-aware compilation, and engine-facing reflection metadata for future material/binding validation.
  • Support a safe development workflow with hot-reload plus CI-friendly build graph integration so runtime and packaging use the same generated outputs.

Description

  • Added a manifest-driven compilation flow and CMake integration that compiles per backend/category/program/variant/stage, emits stage JSON and program.json metadata, and stages outputs under <build>/bin/shaders/bin and <build>/bin/shaders/metadata; see cmake/ShaderCompilation.cmake and cmake/compile_shaders.cmake and shaders/shaders.cmake.
  • Introduced a clean source layout and include rules under shaders/ (shared shaders/includes/, shaders/materials/, shaders/post/, shaders/debug/) and small example shaders and include files demonstrating conventions and predictable include resolution (*.sh, *.def.sc).
  • Implemented an engine-owned runtime API ShaderProgramLibrary (engine/render/shader_library.{hpp,cpp}) with ShaderProgramId, backend-aware path resolution, safe load_program, and timestamp-based reload_if_stale hot-reload that preserves the prior program on failure.
  • Emitted deterministic reflection metadata (stage JSON with SHA256, program.json with stage list/refs), wired packaging/validation to require metadata, updated render_shell to use ShaderProgramLibrary, and added a focused unit test tests/render/shader_pipeline_tests.cpp validating path resolution and backend mapping.

Testing

  • Executed the pipeline script in a shaderc-unavailable mode: cmake -DRENDER_SOURCE_DIR=/workspace/render -DRENDER_SHADER_OUTPUT_ROOT=/tmp/render_shader_out -DRENDER_SHADER_MANIFEST=/workspace/render/shaders/shaders.cmake -DRENDER_BGFX_SHADERC= -DRENDER_REQUIRE_SHADER_COMPILATION=OFF -DRENDER_SHADER_BACKENDS=spirv -P cmake/compile_shaders.cmake, which ran and returned the expected warning path (skipped compilation) and successfully generated no-op logs.
  • Attempted a full CMake configure (cmake --preset linux-debug -DRENDER_ALLOW_FETCHCONTENT=ON) to validate build/test integration, but it failed in this environment due to external network/FetchContent (SDL3) being blocked; this prevented running the full build and CTest in this sandbox.
  • Added render_shader_pipeline_tests and wired it into the unit test suite (CTest) so CI can run the new path-resolution tests when dependencies and network/fetch are available; test compilation/run was not completed here because the full build could not finish in this environment.

Codex Task

@ercmine
ercmine merged commit c968fb7 into main Apr 6, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant